/*
** writen by hanv
** n2.vietha@gmail.com
*/
package vn.vng.research.fsd.services;

import java.util.List;

import org.apache.thrift.TException;

import vn.vng.research.fsd.search.FacetedSearcher;
import vn.vng.research.fsd.services.thrift.SearchService;
import vn.vng.research.fsd.services.thrift.TResult;
import vn.vng.research.fsd.services.thrift.SearchService.Iface;

public class SearchServiceHandle implements SearchService.Iface {

	@Override
	public TResult search(int uid, String query, int hitsPerPage,
			int pageNumber) throws TException {
		// TODO Auto-generated method stub
		try {
			return FacetedSearcher.search(query,hitsPerPage,pageNumber);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}

	@Override
	public TResult facet(int uid, long searchid, String query,
			List<Integer> schoolsid, int hitsPerPage, int pageNumber)
			throws TException {
		// TODO Auto-generated method stub
		try {
			return FacetedSearcher.facet(searchid, query, schoolsid, hitsPerPage, pageNumber);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}
//	@Override
//	public TResult search(int uid, String query, ) throws TException {
//		// TODO Auto-generated method stub
//		try {
//			return FacetedSearcher.search(query,50,1);
//		} catch (Exception e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//			return null;
//		}
//	}
//
//	@Override
//	public TResult facet(int uid, long searchid, String query,
//			List<Integer> schoolsid) throws TException {
//		// TODO Auto-generated method stub
//		try {
//			return FacetedSearcher.facet(searchid, query, schoolsid,50,1);
//		} catch (Exception e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//			return null;
//		}
//	}


}
